public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	switch(dialogid) {
		case DIALOG_LOGIN: {
			if (!response) {
				CPlayer::KickEx(playerid, "Server", "Incorrect login", false);
				return true;
			}
			
			if (!CAccount::checkPassword(playerid, inputtext)) {
                playerData[playerid][wrongPW]++;
                SendFormattedMessage(playerid, C_RED, "* Error: Incorrect password. (Attempt %d of 3)", playerData[playerid][wrongPW]);
                
                if(playerData[playerid][wrongPW] == 3) {
                    CPlayer::KickEx(playerid, "Server", "Incorrect password", false);
                    return true;
                }
                
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login Box", "{FFFFFF}Please enter your {FF0000}password{FFFFFF} to spawn", "Login", "Quit");    
                return true;
            }
            
            SendFormattedMessage(playerid, C_GREEN, "You've been logged in successfully and your statistics have been loaded. (%s)", CPlayer::getLevelName(playerid));
            return true;
		}
		
		case DIALOG_REGISTER: 
		{
			if (!response) 
			{
				CPlayer::KickEx(playerid, "Server", "Authentication failed", false);
				return true;
			}
			
            if (!strlen(inputtext)) {
                SendClientMessage(playerid, C_RED, "* Error: The password must be longer than 1 character.");
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register Box", "{FF0000}Please register first\n{FFFFFF}Enter your password below", "Register", "Quit");
                return true;
            }
                
            CAccount::registerPlayer(playerid, inputtext);
            SendClientMessage(playerid, C_GREEN, "You successfuly registered your name and your statistics will be saved from now on!");
            return true;
		}
		
		case DIALOG_WEAPONS: {
			new Weapon_1 = weaponSets[listitem][0],
				Weapon_2 = weaponSets[listitem][1],
				Team = playerData[playerid][team];
				
			if (!response) {
		        CPlayer::ShowWeaponMenu(playerid);
		        return true;
		 	}
			
			Weapon_1 = weaponSets[listitem][0];
			Weapon_2 = weaponSets[listitem][1];
			Team = playerData[playerid][team];
			
			if ((iWeaponSets[Team][Weapon_1] >= weaponRestrictions[Weapon_1]) && weaponRestrictions[Weapon_1] != 0) {
				SendFormattedMessage(playerid, C_RED, "* Error: Weapon %s is restricted to %d per team.", getWeaponNameEx(Weapon_1), weaponRestrictions[Weapon_1]);
				CPlayer::ShowWeaponMenu(playerid);
				return true;
			}
				
			if ((iWeaponSets[Team][Weapon_2] >= weaponRestrictions[Weapon_2]) && weaponRestrictions[Weapon_2] != 0) {
				SendFormattedMessage(playerid, C_RED, "* Error: Weapon %s is restricted to %d per team.", getWeaponNameEx(Weapon_2), weaponRestrictions[Weapon_2]);
				CPlayer::ShowWeaponMenu(playerid);
				return true;
			}
			
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid, Weapon_1, 9999);
			GivePlayerWeapon(playerid, Weapon_2, 9999);
			GivePlayerWeapon(playerid, 1, 1);
			
			if (gameConfig[bUseKnifes] == true) 
				GivePlayerWeapon(playerid, 4, 1);
			
			GivePlayerWeapon(playerid, 46, 1);
			
			iWeaponSets[Team][Weapon_1]++;
			iWeaponSets[Team][Weapon_2]++;
			
			Team(Team, "%s has chosen weaponset %d. (%s, %s)", CPlayer::getName(playerid), listitem, getWeaponNameEx(Weapon_1), getWeaponNameEx(Weapon_2));
		}

		case DIALOG_SWITCH: {
			if (!response) {
				SendClientMessage(playerid, C_GOLD, "* Team selection aborted.");
				return true;
			}
			
			switch(listitem) {
				case TEAM_HOME: {
					CPlayer::crashSafeSkinSync(playerid, gameConfig[teamSkin][TEAM_HOME]);
					
					playerData[playerid][team] = TEAM_HOME;
					CPlayer::UpdatePlayerColor(playerid);
					
					if (teamData[TEAM_HOME][bAttacking] == true) 
						SendFormattedMessageToAll(C_ATT, "* %s switched himself to team %s. (Attacking)", CPlayer::getName(playerid), gameConfig[homeName]);
					
					else 
						SendFormattedMessageToAll(C_DEF, "* %s switched himself to team %s. (Defending)", CPlayer::getName(playerid), gameConfig[homeName]);
				}
				
				case TEAM_AWAY: {
					CPlayer::crashSafeSkinSync(playerid, gameConfig[teamSkin][TEAM_AWAY]);
					
					playerData[playerid][team] = TEAM_AWAY;
					CPlayer::UpdatePlayerColor(playerid);
					
					if (teamData[TEAM_AWAY][bAttacking] == true)
						SendFormattedMessageToAll(C_ATT, "* %s switched himself to team %s. (Attacking)", CPlayer::getName(playerid), gameConfig[awayName]);
					
					else 
						SendFormattedMessageToAll(C_DEF, "* %s switched himself to team %s. (Defending)", CPlayer::getName(playerid), gameConfig[awayName]);
				}
				
				case TEAM_REF: {
					CPlayer::crashSafeSkinSync(playerid, gameConfig[teamSkin][TEAM_REF]);
					
					playerData[playerid][team] = TEAM_REF;
					CPlayer::UpdatePlayerColor(playerid);
					
					SendFormattedMessageToAll(C_YELLOW, "* %s switched himself to team Referee.", CPlayer::getName(playerid));
				}
				
				case TEAM_HOME_SUB: {
					CPlayer::crashSafeSkinSync(playerid, gameConfig[teamSkin][TEAM_HOME]);
					
					playerData[playerid][team] = TEAM_HOME_SUB;
					CPlayer::UpdatePlayerColor(playerid);
					if (teamData[TEAM_HOME][bAttacking] == true) 
                    {
						SendFormattedMessageToAll(C_ATT, "* %s switched himself to substitute for team %s. (Attacking)", CPlayer::getName(playerid), gameConfig[homeName]);
					}
					
					else 
                    {
						SendFormattedMessageToAll(C_DEF, "* %s switched himself to substitute for team %s. (Defending)", CPlayer::getName(playerid), gameConfig[homeName]);
					}
				}
				
				case TEAM_AWAY_SUB: {
					CPlayer::crashSafeSkinSync(playerid, gameConfig[teamSkin][TEAM_AWAY]);
					
					playerData[playerid][team] = TEAM_AWAY_SUB;
					CPlayer::UpdatePlayerColor(playerid);
                    
					if (teamData[TEAM_AWAY][bAttacking] == true)
						SendFormattedMessageToAll(C_ATT, "* %s switched himself to substitute for team %s. (Attacking)", CPlayer::getName(playerid), gameConfig[awayName]);
					
					else 
						SendFormattedMessageToAll(C_DEF, "* %s switched himself to substitute for team %s. (Defending)", CPlayer::getName(playerid), gameConfig[awayName]);
				}
			}
		}
	}
	
	return true;
}